'use strict';

module.exports = app => {
    const { Sequelize, model } = app
    const Model = model.define('corp', {
        id:{
            type: Sequelize.STRING.BINARY,
            defaultValue: Sequelize.UUIDV1,
            primaryKey: true
        },
        postalCode: {
            type: Sequelize.STRING(10),
        },
        carPrefix: {
            type: Sequelize.STRING(2),
            allowNull: false,
        },
        corpName: {
            type: Sequelize.STRING(50),
            allowNull: false,
        },
        useName: {
            type: Sequelize.STRING(50),
            allowNull: false,
        },
        boss: {
            type: Sequelize.STRING(30),
            allowNull: false,
        },
        address: {
            type: Sequelize.STRING(100),
            allowNull: false,
        },
        area: {
            type: Sequelize.STRING(20),
        },
        mobile: {
            type: Sequelize.STRING(20),
            allowNull: false,
        },
        telephone: {
            type: Sequelize.STRING(20),
        },
        regDate: {
            type: Sequelize.DATE,
        },
        pointX: {
            type: Sequelize.DOUBLE,
        },
        pointY: {
            type: Sequelize.DOUBLE,
        },
        smsLimit: {
            type: Sequelize.INTEGER(8),
            defaultValue: 0,
            allowNull: false,
        },
        smsSign: {
            type: Sequelize.STRING(20),
        },
        openFlag: {
            type: Sequelize.INTEGER(2),
            defaultValue: 0,
            allowNull: false,
        },
        bookFlag: {
            type: Sequelize.INTEGER(3),
            defaultValue: 0,
            allowNull: false,
        },
        imgUrl: {
            type: Sequelize.STRING,
        },
        regCode:{
            type: Sequelize.STRING(30),
        },
        regStatus:{
            type: Sequelize.INTEGER(1),
            defaultValue: 0,
        },
        payMchid:{
            type: Sequelize.STRING(30),
        },
        payKey:{
            type: Sequelize.STRING(50),
        },
        wzSearch:{
            type: Sequelize.INTEGER(6),
            defaultValue: 0,
            allowNull: false,
        },
        tempSearch:{
            type: Sequelize.INTEGER(6),
            defaultValue: 0,
            allowNull: false,
        },
        wzWallet:{
            type: Sequelize.INTEGER(8),
            defaultValue: 0,
            allowNull: false,
        }
    }, {
        freezeTableName: true,
        tableName: 'sys_corp',
        timestamps: true,
        paranoid: true,
    })

    return Model
}